import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 分页获取该学校待确认设备列表
export function list (query) {
    return request({
        url: '/manage/schoolDevice/schoolDevicePage',
        method: 'get',
        params: query
    })
}

// 详情
export function getById (query) {
    return request({
        url: '/manage/schoolDevice/getInfo/' + query.id,
        method: 'get',
        params: query
    })
}

// 新增
export function add (data) {
    return request({
        url: '/manage/schoolDevice/addCustomDevice',
        method: 'post',
        data: data
    })
}

// 修改
export function edit (data) {
    return request({
        url: '/manage/schoolDevice/edit',
        method: 'put',
        data: data
    })
}

// 删除
export function deleteById (data) {
    return request({
        url: '/manage/schoolDevice/deleteById/' + data.id,
        method: 'delete',
        data
    })
}

// 根据周转箱id获取周转箱设备列表
export function getDeviceListByBoxId (id) {
    return request({
        url: '/manage/schoolDevice/getSchoolDeviceListByBoxId/' + id,
        method: 'get'
    })
}

// 获取该学校周转箱列表
export function getSchoolTurnoverBoxList () {
    return request({
        url: '/manage/schoolDevice/getSchoolTurnoverBoxList',
        method: 'get'
    })
}


// 分页获取该学校已确认设备列表
export function schoolDevicePageV2 (query) {
    return request({
        url: '/manage/schoolDevice/schoolDevicePageV2',
        method: 'get',
        params: query
    })
}

// 确认设备状态
export function setConfirmStatus (data) {
    return request({
        url: '/manage/schoolDevice/setConfirmStatus/' + data.id,
        method: 'put',
        data: data
    })
}

// 批量确认设备状态
export function setConfirmStatusByIds (data) {
    return request({
        url: '/manage/schoolDevice/setConfirmStatusByIds/' + data.id,
        method: 'put',
        data: data
    })
}

export const apiExportDevice = (query) => {
  return request({
    url: '/manage/schoolDevice/exportSchoolDevice',
    method: 'get',
    params: query
  })
}
